﻿using System.Web.Mvc;
using System.Web.Routing;

namespace ASP.NET_MVC_Static_Test
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            //routes.MapRoute(
            //    name: "html",
            //    url: "{webdomain}/{action}.html",
            //    defaults: new { controller = "Home", action = "Index", webdomain = UrlParameter.Optional, id = UrlParameter.Optional },
            //    constraints: new { webdomain = "\\w+", id = "" }
            //    //namespaces: new[] { "ASP.NET_MVC_Static_Test.Controllers" }//默认命名空间
            //);

            routes.MapRoute(
                name: "webfz",
                url: "{webdomain}/{*id}",
                defaults: new { controller = "Home", action = "Index", webdomain = UrlParameter.Optional, id = "" },
                constraints: new { webdomain = "\\w+", id = "" }
            );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
            
        }
    }
}
